﻿package plugin.fashen.game
{
    import com.core.*;
    import flash.display.*;
    import flash.geom.*;
    import view.uilt.*;

    public class FaShenTips extends Sprite
    {
        private var cfgHero:Object;
        private var cfgItem:Object;

        public function FaShenTips()
        {
            this.cfgHero = ConfigDictionary.data.hero;
            this.cfgItem = ConfigDictionary.data.item;
            return;
        }// end function

        public function showTips(param1:int, param2:String, param3:Point) : void
        {
            var _loc_5:Object = null;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:Array = null;
            var _loc_9:int = 0;
            var _loc_4:String = "增加属性\n";
            if (this.cfgHero[param2].atk > 0 || this.cfgHero[param2].atkmax > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>物理攻击: </font><font color=\'#53b436\'>" + this.cfgHero[param2].atk + " - " + this.cfgHero[param2].atkmax + "</font>\n");
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>魔法攻击: </font><font color=\'#53b436\'>" + this.cfgHero[param2].atk + " - " + this.cfgHero[param2].atkmax + "</font>\n");
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>道术攻击: </font><font color=\'#53b436\'>" + this.cfgHero[param2].atk + " - " + this.cfgHero[param2].atkmax + "</font>\n");
            }
            if (this.cfgHero[param2].phydef > 0 || this.cfgHero[param2].phydefmax > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>物理防御: </font><font color=\'#53b436\'>" + this.cfgHero[param2].phydef + " - " + this.cfgHero[param2].phydefmax + "</font>\n");
            }
            if (this.cfgHero[param2].magdef > 0 || this.cfgHero[param2].magdefmax > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>魔法防御: </font><font color=\'#53b436\'>" + this.cfgHero[param2].magdef + " - " + this.cfgHero[param2].magdefmax + "</font>\n");
            }
            if (this.cfgHero[param2].hp > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>生命值: </font><font color=\'#53b436\'>" + String(int(this.cfgHero[param2].hp) / 100) + "%</font>\n");
            }
            if (this.cfgHero[param2].mp > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>魔法值: </font><font color=\'#53b436\'>" + String(int(this.cfgHero[param2].mp) / 100) + "%</font>\n");
            }
            if (this.cfgHero[param2].critrate > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>暴击伤害: </font><font color=\'#53b436\'>" + this.cfgHero[param2].critrate + "</font>\n");
            }
            _loc_4 = _loc_4 + "\n法神召唤\n";
            if (this.cfgHero[param2].dayfightnum > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>召唤次数: </font><font color=\'#53b436\'>" + this.cfgHero[param2].dayfightnum + "</font>\n");
            }
            if (this.cfgHero[param2].shijian > 0)
            {
                _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>召唤时间: </font><font color=\'#53b436\'>" + this.cfgHero[param2].shijian + "秒</font>\n");
            }
            if (param1 == 2)
            {
                _loc_4 = _loc_4 + "\n升级消耗\n";
                if (this.cfgHero[param2].money > 0)
                {
                    _loc_6 = ModelProxy.getValue("data", "bag").bgold;
                    _loc_7 = ModelProxy.getValue("data", "bag").gold;
                    if (_loc_6 >= int(this.cfgHero[param2].money))
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>绑定金币: </font><font color=\'#53b436\'>" + this.cfgHero[param2].money + "</font>\n");
                    }
                    else if (_loc_7 >= int(this.cfgHero[param2].money))
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>绑定金币: </font><font color=\'#53b436\'>" + this.cfgHero[param2].money + "</font>\n");
                    }
                    else
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>绑定金币: </font><font color=\'#c72514\'>" + this.cfgHero[param2].money + "</font>\n");
                    }
                }
                if (this.cfgHero[param2].itemid)
                {
                    _loc_8 = (this.cfgHero[param2].itemid as String).split("#");
                    _loc_9 = ItemUilt.getAllCount(_loc_8[0]);
                    if (_loc_9 >= _loc_8[1])
                    {
                        _loc_4 = _loc_4 + (this.cfgItem[_loc_8[0]].name + ": " + "<font color=\'#53b436\'>" + _loc_8[1] + "个</font>\n");
                    }
                    else
                    {
                        _loc_4 = _loc_4 + (this.cfgItem[_loc_8[0]].name + ": " + "<font color=\'#c72514\'>" + _loc_8[1] + "个</font>\n");
                    }
                }
                _loc_4 = _loc_4 + "\n升级条件\n";
                _loc_5 = ModelProxy.getValue("data", "user");
                if (int(this.cfgHero[param2].rein))
                {
                    if (_loc_5.rein >= this.cfgHero[param2].rein)
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>需要转生: </font><font color=\'#53b436\'>" + this.cfgHero[param2].rein + "转</font>\n");
                    }
                    else
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>需要转生: </font><font color=\'#c72514\'>" + this.cfgHero[param2].rein + "转</font>\n");
                    }
                }
                if (this.cfgHero[param2].rolelevel)
                {
                    if (_loc_5.level >= this.cfgHero[param2].rolelevel)
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>需要等级: </font><font color=\'#53b436\'>" + this.cfgHero[param2].rolelevel + "级</font>\n");
                    }
                    else
                    {
                        _loc_4 = _loc_4 + ("<font color=\'#ffd437\'>需要等级: </font><font color=\'#c72514\'>" + this.cfgHero[param2].rolelevel + "级</font>\n");
                    }
                }
            }
            ModelProxy.change("tips", "normal", {data:_loc_4, p:param3});
            return;
        }// end function

    }
}
